SocketException

sealed class SocketException

Thrown by the suspending members of NamespaceSocket and SocketClient when an operation cannot complete.

Every instance carries the same sealed SocketError used by the NamespaceSocket.errors and SocketClient.errors streams, so one when handles a failure regardless of whether it arrived by throw or by flow:

try {
socket.openAwait()
socket.emitAwait("hello", "world")
} catch (e: SocketException) {
when (e.error) {
is SocketError.ConnectError -> refreshCredentials()
is SocketError.Timeout -> retryLater()
else -> report(e.error)
}
}

The two subclasses distinguish where the failure occurred; catching SocketException itself is usually enough. The hierarchy is sealed — new failure modes surface as new SocketError values, never as new exception types.

Inheritors

Types

Link copied to clipboard
Link copied to clipboard

The event was rejected before it reached the outbound queue — thrown by NamespaceSocket.emitAwait, SocketClient.emitAwait and NamespaceSocket.emitWithAck.

Properties

Link copied to clipboard

The failure, in the same vocabulary as the errors streams.